<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ActivityRecharge extends BaseModel
{
    public function setPriceAttribute($value)
    {
        return $this->attributes['price'] = $value * 100;
    }
    
    public function setGiveAttribute($value)
    {
        return $this->attributes['give'] = $value * 100;
    }
    
    public function setStartTimeAttribute($value)
    {
        return $this->attributes['start_time'] = strtotime($value);
    }
    
    public function setEndTimeAttribute($value)
    {
        return $this->attributes['end_time'] = strtotime($value);
    }
    
    public function getPriceAttribute($value)
    {
        return $value / 100;
    }
    
    public function getGiveAttribute($value)
    {
        return $value / 100;
    }
    
    public function getStartTimeAttribute($value)
    {
        return date('Y-m-d H:i:s', $value);
    }
    
    public function getEndTimeAttribute($value)
    {
        return date('Y-m-d H:i:s', $value);
    }
}
